chore(test): add stack lifecycle events screen test with scenario#4305
Open
LKuchno wants to merge 12 commits into
Open
chore(test): add stack lifecycle events screen test with scenario#4305LKuchno wants to merge 12 commits into
LKuchno wants to merge 12 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Stack v5 single-feature test screen to manually verify gamma StackContainer lifecycle callbacks (onWillAppear, onDidAppear, onWillDisappear, onDidDisappear) across push/pop flows, including a nested stack, using toast messages to visualize event order.
Changes:
- Introduces a new “Stack lifecycle events” scenario screen that triggers toast notifications from lifecycle callbacks for each route (outer + nested stack).
- Adds a detailed manual test scenario (
scenario.md) documenting expected event sequences per platform and per navigation method. - Registers the new scenario in the Stack v5 scenario group.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| apps/src/tests/single-feature-tests/stack-v5/test-stack-lifecycle-events/scenario.md | New manual scenario documenting expected lifecycle event ordering for push/pop and nested stack flows. |
| apps/src/tests/single-feature-tests/stack-v5/test-stack-lifecycle-events/scenario-description.ts | Adds scenario metadata (name/key/details/platforms/e2eCoverage). |
| apps/src/tests/single-feature-tests/stack-v5/test-stack-lifecycle-events/index.tsx | Implements the new test screen with outer + nested StackContainer and toast-based lifecycle callbacks. |
| apps/src/tests/single-feature-tests/stack-v5/index.ts | Registers and exports the new Stack v5 scenario so it appears in the scenario group/menu. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…tware-mansion/react-native-screens into @lkuchno/test-stack-lifecycle-events
…ps to confim pop/push events for nested stacks
…on iOS on this screen two headers are visible
kligarski
reviewed
Jul 13, 2026
Comment on lines
+51
to
+56
| **Android** — only the screen entering or leaving the stack fires; the | ||
| screen underneath stays silent: | ||
| - **Push (Y pushed over X):** only the pushed screen fires — | ||
| `Y: onWillAppear`, then `Y: onDidAppear`. X fires nothing. | ||
| - **Pop (Y popped, back to X):** only the popped screen fires — | ||
| `Y: onWillDisappear`, then `Y: onDidDisappear`. X fires nothing. |
Contributor
There was a problem hiding this comment.
This should change soon when we handle detach and attach in fragment manager. Not sure if we should merge the test in its current form or wait for the changes?
cc @kkafar
…ns into @lkuchno/test-stack-lifecycle-events
kligarski
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes: https://github.com/software-mansion/react-native-screens-labs/issues/1607
Adds a new single-feature test screen exercising the gamma
StackContainerscreen lifecycle callbacks —onWillAppear,onDidAppear,onWillDisappear,onDidDisappear— across push, pop, and a nested stack. It mirrors the existingtest-tabs-lifecycle-eventsscreen so stack and tabs lifecycle behaviour can be checked with the same toast-based visualization.Each transition pushes a color-coded toast (
onWillAppear- green,onWillDisappear- light navy,onDidAppear- light blue,onDidDisappear— dark navy) so the fired events and their order are visible on device.Changes
test-stack-lifecycle-events/index.tsx— test screen: an outer stack (Home → A → NestedStack) and a nested stack (NestedHome → NestedA). A shareduseMakeLifecycleCallbackshook attaches the four lifecycle callbacks to every route. Every route sets a headertitle; theNestedStackroute's header is intentionally shown, so on iOS the outerNestedStackheader and the inner nested-stack header stack together — letting the scenario exercise popping the whole container via the outerNestedStackheader back button as well as the inner one.test-stack-lifecycle-events/scenario.md— manual scenario covering push/pop (Pop button / header back button / native gesture / system back) at the top level and inside the nested stack, plus crossing the nested-stack boundary — popping the whole container back toHomefrom bothNestedHomeandNestedAvia the outerNestedStackheader back button. Documents per-platform event orderings, including the iOS outer-first vs Android inner-first difference on the container pop.test-stack-lifecycle-events/scenario-description.ts— scenario metadata (e2eCoverage: 'tbd', platforms iOS + Android).stack-v5/index.ts— registers the scenario in the Stack v5 group.Note:
This test will have to be updated if https://github.com/software-mansion/react-native-screens-labs/issues/1649 is fixed, and the changes mentioned by @kligarski in #4305 (comment) are implemented.